import { IsEmail, IsNotEmpty, IsUrl, Length, MaxLength } from "class-validator"

export class CreateUserDto  {
    @MaxLength(20, { message: '用户名最大长度为20位' })
    nickName?: string

    @MaxLength(20, { message: '账户最大长度为20位' })
    @IsNotEmpty()
    account: string

    @IsNotEmpty()
    @Length(6, 20, { message: '密码长度必须在6到20位之间' })
    password: string

    @IsUrl(undefined, { message: '头像地址不合法' })
    avatar?: string

    @IsEmail(undefined, { message: "邮箱格式不正确" })
    email?: string
}
